function a(ctx) {
  try {
    const res = typeof ctx == "string" ? JSON.parse(ctx) : ctx
    return {
      body: {
        key: res.key,
        id: res.newId ? res.newId : res.id,
        country: res.country,
        card: res.card,
      },
    }
  } catch (e) {
    console.log(e)
    return {
      result: "fail",
      reason: "ctx结构有误，JSON解析失败",
    }
  }
}

// const data = `1|1231231321235658|viber来电号码转短信[三一一四八九八五六五八]：后4位5658。`;
const data2 = {
  iid: "1000",
  token: "fa63dfce88f505903e631aecdd958567_29062",
  country: "usa",
}
const data = `1|1231231321235658|viber来电号码转短信[三一一四八九八五六五八]：后4位5658。`

console.log(a(data2, data))
